﻿@model IList<Romantics.Domain.Objects.Region>
@using Romantics
@{
    Romantics.Domain.Objects.Region selected = ViewBag.Region;
    var Controller = ((string)ViewContext.RouteData.Values["Controller"]);
}
<div class="sidebar">
  @if (Model.Count > 0)
  {
      <h3>География</h3>
      <ul>
      @foreach (var country in Model.Select(r=>r.Country).OrderBy(c=>c.Name).Distinct())
      {
        <li><a><b>@country.Name</b></a></li>
        foreach (var region in Model.Where(r=>r.Country == country).OrderBy(r=>r.Name).Distinct())
        {
            <li>@Html.ShortRegionLink(region, Controller, selected)</li>
        }
      }
      </ul>
  }
</div>
